package com.cwf.system.vo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.cwf.system.entity.Role;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.SuperBuilder;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@ToString
public class RoleInfoVO {

    private Long roleId;
    /**
     * 角色名称
     */
    private String roleName;
    /**
     * 角色描述
     */
    private String roleDesc;
    /**
     * 最后编辑人id
     */
    private Long editUserId;
    /**
     * 创建者id
     */
    private Long creatorId;
    /**
     * 状态
     */
    private Integer state;


    public static Role toEntity(RoleInfoVO roleInfoVO){
        Role role = new Role();

        role.setRoleId(roleInfoVO.getRoleId());
        role.setRoleName(roleInfoVO.getRoleName());
        role.setRoleDesc(roleInfoVO.getRoleDesc());
        role.setEditUserId(roleInfoVO.getEditUserId());
        role.setCreatorId(roleInfoVO.getCreatorId());
        role.setState(roleInfoVO.getState());

        return role;
    }



    public static RoleInfoVO toRoleInfoVO(Role role){
        RoleInfoVO roleInfoVO = new RoleInfoVO();

        roleInfoVO.setRoleId(role.getRoleId());
        roleInfoVO.setRoleName(role.getRoleName());
        roleInfoVO.setRoleDesc(role.getRoleDesc());
        roleInfoVO.setEditUserId(role.getEditUserId());
        roleInfoVO.setCreatorId(role.getCreatorId());
        roleInfoVO.setState(role.getState());

        return roleInfoVO;
    }

}
